﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;

public partial class HomePage_Announce : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }


    public string WriteBord()
    {
        int i = 0;
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        //HZ.MBSM.DBUtility.Db db = new HZ.MBSM.DBUtility.Db();
        Db db = new Db();
        DbPage dbPage = new DbPage(db);
        dbPage.Table = "project_bulletin";                                               //要查询的表明
        dbPage.Key = "projectid";                                               //表的主键    
        dbPage.Where = "";                                           //查询条件    
        dbPage.SelectField = "projectid,Title, ProjectBeginDate";//要显示的字段
        dbPage.PageIndex = SysFun.ToInt(Request["CurrentlyPageIndex"]);          //要显示第几页   
        dbPage.PageSize = 22;                                                    //没有显示记录条数   
        dbPage.OrderBy = " projectBeginDate";                  //排序字段
        dbPage.OrderByIsDesc=true  ;
        System.Data.IDataReader dr = dbPage.ExecuteReader();

        sb.Append("<table  width='98%' border=0 align=center cellpadding=6 cellspacing=1>");
        while (dr.Read())
        {
            i++;
            sb.Append("<tr><td class='dotbottomline'>");
            sb.Append("<img src='../images/ico7.gif' width='8' height='5' hspace='4' vspace='1'>");
            sb.Append("<a href='../Agency/project_bulletininfo.aspx?projectid=" + dr["projectid"].ToString() + "' target=_blank>" + dr["Title"].ToString() + "(" + Convert.ToDateTime(dr["ProjectBeginDate"].ToString()).ToShortDateString() + ")</a>");
            sb.Append("<img src='../images/new.gif' width='28' height=11>"); 
            sb.Append("</td></tr>");
        }
        for (int j = i; j < 22; j++)
            sb.Append("<tr><td class='dotbottomline'>&nbsp;</td></tr>");

       
        sb.Append("</table>");
        dr.Close();
        dr.Dispose();
        
        db.Close();
        this.DbPageFlip1.DbPage = dbPage;//将数据传给控键
        dbPage.Db.Close();

        return sb.ToString();
    }

}
